package com.sentrix.auto.printercenter.presentation.center;

import com.mybatisflex.core.paginate.Page;
import com.sentrix.auto.printercenter.application.PrinterTaskQueryService;
import com.sentrix.auto.printercenter.presentation.center.dto.PrinterTaskPageQueryReqDto;
import com.sentrix.auto.printercenter.presentation.center.dto.PrinterTaskResDto;
import com.sentrix.auto.printercenter.presentation.common.DataResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Tag(name = "打印任务管理", description = "打印任务管理")
@Slf4j
@RestController
@RequestMapping("printer/task")
public class PrinterTaskController {

    @Resource
    private PrinterTaskQueryService taskQueryService;

    @Operation(summary = "详情查询：打印任务详情")
    @Parameter(name = "id", required = true, description = "打印任务ID")
    @GetMapping("{id}/detail")
    public DataResponse detail(@PathVariable("id") Long id) {
        return new DataResponse("1", true, 200, "success");
    }

    @Operation(summary = "列表查询：打印任务列表")
    @PostMapping("page")
    public DataResponse<PrinterTaskResDto> page(@Validated @RequestBody PrinterTaskPageQueryReqDto param) {
        Page page = taskQueryService.page(param, PrinterTaskResDto::fromDomain);
        return new DataResponse("1", true, 200, "success", page);
    }


}
